<template>
    <div>
  <!-- <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
  <van-swipe-item><img src="../assets/1.png" alt=""></van-swipe-item>
  <van-swipe-item><img src="../assets/2.png" alt=""></van-swipe-item>
  <van-swipe-item><img src="../assets/3.png" alt=""></van-swipe-item>
</van-swipe> -->
<div class="swiper">
  <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
  <van-swipe-item><img src="../assets/1.png" alt=""></van-swipe-item>
  <van-swipe-item><img src="../assets/2.png" alt=""></van-swipe-item>
  <van-swipe-item><img src="../assets/3.png" alt=""></van-swipe-item>
</van-swipe>
<van-search class="search"
  v-model="value"
  label="上海"
  placeholder="请输入搜索关键词"
>
<template #label>
  <div @click="onSearch">上海</div>
</template>
</van-search>
</div>
<van-grid :border="false" :gutter="10"  class="icon">
  <van-grid-item class="iconfont" icon="wap-home-o" text="整租"  @click="clickFn"/>
  <van-grid-item class="iconfont" icon="friends-o" text="合租"  @click="clickFn"/>
  <van-grid-item class="iconfont" icon="location-o" text="地图找房" @click="clFn1"/>
  <van-grid-item class="iconfont" icon="wap-home-o" text="去出租" @click="clFn" />
</van-grid>
<div class="list">
  <h1>租房小组</h1>
  <span>更多</span>
</div>

<ul>
  <li v-for="item in houseFiendList" :key='item.id'>
    <div class="pic"> 
      <img :src="`http://liufusong.top:8080${item.imgSrc}`"  alt="">
    </div>
    <div class="txt">
      <span>{{ item.title }}</span>
      <span>{{ item.desc }}</span>
    </div>
  </li>
</ul> 
</div>

</template>

<script>
import request from '@/utils/request'
import {getItem} from '@/utils/storage.js'
export default {
    props: {

    },
    data() {
        return {
         value:'',
         houseFiendList:[]
        };
    },
    mounted () {
      this.getPicture()
      this.getHouseFriend()
    },
    methods: {
      async getPicture () {
        const { body } = await request.get('/home/swiper')
        this.picList = body
      },
      async getHouseFriend  () {
        const { body } = await request.get('/home/groups')
        console.log(body);
        this.houseFiendList  = body
      },
      clickFn() {
        this.$router.push('/home/find')
      },
      clFn() {
        this.$router.push('/house')
      },
      clFn1() {
        this.$router.push('/baiduMap')
      },
      onSearch() {
        this.$router.push('/citylist')
      }
    },
    computed:{
      // huoqu() {
      //   return getItem('key')
      // }
    }
};
</script>

<style lang="less" scoped>
body {
    background-color: #f5f6f5;
}
 .swiper {
    position: relative;
    .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    width: 100%;
    height: 212px;
    line-height: 212px;
    text-align: center;
    background-color: #fff;
    img {
        width: 100%;
    }
  }
  .search{
    position: absolute;
    left:10px;
    top:15px;
    width: 310px;
    height: 34px;
    background-color: #fff;
    border-radius: 5px;
  }
  }
  .icon {
    margin-top: 20px;
    color:#21b97a;
    // border-radius: 50%;
  }
  // @grid-item-icon-size: 60px;
  // @grid-item-icon-size: 14px;
  .list {
    margin-top: 15px;
    display: flex;
    justify-content: space-between;
    background-color:#f6f5f6;
    
    h1{
      margin-left: 10px;
      font-size: 16px;
      color:#000
    }
    span {
      font-size: 14px;
      color:#787d82;
      margin-right: 15px;
      margin-top: 12px;
    }
  }
  ul {
    display: flex;
    flex-wrap: wrap;
    margin: 0 12px;
    background-color:#f6f5f6;
   li {
    display: flex;
    align-items: center;
    width: 48%;
    height: 70px;
    margin-bottom: 8px;
    margin-right: 4px;
    background-color: #fff;
    border-radius: 4px;
    .pic {
      padding-left: 10px;
      width: 60px;
      height: 60px;
      img {
        width: 100%;
      }
    }
    .txt {
      padding-left: 6px;
      span {
        margin: 0;
        font-size: 14px;
      }
    }
    &:nth-child(2n) {
      margin-left: 4px;
    }
   }
  }
  
</style>
